home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_pow_srailcharges_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
4KB
|
171 lines
# Jedi Knight Missions Cog Script
#
# POW_SRAILCHARGES_M.COG
#
# POWERUP Script - Seeking Rail Charges
#
# [YB & CYW] + [RF]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
thing powerup local
thing player local
thing sender local
flex damage local
int bin=91 local
sound pickupsnd=helthpu1.wav local
sound respawnsnd=Activate01.wav local
flex amount local
template sparkTemplate=+sparks local
int scratch local
sound fireSound=RailChargeFire01.WAV local
template projectile=+sraildet local
template blast=+small_exp local
vector thingPos local
vector randVec local
int bin_contents=0 local
message timer
message created
message damaged
message touched
message taken
message respawn
end
# ========================================================================================
code
created:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
Return;
# ............................................................................................
touched:
player = GetSourceRef();
amount = GetInv(player, bin);
if (amount < GetInvMax(player, bin))
{
TakeItem(GetSenderRef(), -1);
call taken;
}
Return;
# ........................................................................................
damaged:
damage = GetParam (0);
sender = GetSenderRef();
// If it's already dead, don't allow any more damage.
if ((GetThingUserData (sender) == 0.0) || (rand() < 0.5))
return;
// see if this will cause the explosion
if (GetThingUserData (sender) <= damage)
{
SetThingUserData(sender, 0.0);
CreateThingNR(sparkTemplate, sparkSpot);
SetTimerEx(0.5, 2, sender, 0);
}
else
{
SetThingUserData(sender, GetThingUserData (sender) - damage);
}
ReturnEx (0);
return;
# ........................................................................................
taken:
player = GetSourceRef();
powerup = GetSenderRef();
// If the object has been destroyed, don't award it to the player.
// if (GetThingUserData (sender) == 0.0)
// return;
// Print("Rail Charges");
jkPrintUNIString(player, bin);
// Do effects.
PlaySoundLocal(pickupsnd, 1, 0, 0);
AddDynamicTint(player, 0.0, 0.0, 0.2);
// store the old bin contents
bin_contents = GetInv(player, bin);
// Increment powerup amount.
ChangeInv(player, bin, 3.0);
// Check for Auto Reload
if(GetAutoReload() & 1)
{
if(!bin_contents)
{
if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
{
// Try to autoselect and see if the best weapon is the seeking railgun
if(AutoSelectWeapon(player, 2) == GetWeaponBin(17)) SelectWeapon(player, GetWeaponBin(17));
}
}
}
Return;
# ........................................................................................
respawn:
SetThingUserData(GetSenderRef(), 30); // set the initial user data (i.e. "health")
PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
Return;
# ........................................................................................
timer:
sender = GetParam(0);
if (GetSenderID() == 1)
{
thingPos = GetThingPos(sender);
scratch = GetParam(1);
while (scratch > 0)
{
randVec = VectorSet(rand() * 20, rand() * 360, 0);
CreateThingAtPosNR(projectile, GetThingSector(sender), thingPos, randVec);
scratch = scratch - 1;
}
// Since the user data is 0, the player won't actually be awarded this powerup.
TakeItem(sender, -1);
}
else
if (GetSenderID() == 2)
{
SetTimerEx(0.5, 1, sender, 2);
CreateThingNR(blast, sender);
}
return;
end